package com.designPattern.composite;


import java.util.LinkedList;
import java.util.List;

/**
 * @author mxs
 */
public class University extends OrganizationComponent {
    List<OrganizationComponent> collages = new LinkedList();
    public University(String des, String name) {
        super(des, name);
    }

    @Override
    public void print() {
        System.out.println(this.getName());
        System.out.println("=========================================");
        for (OrganizationComponent collage : collages) {
            collage.print();
        }
    }

    @Override
    public void add(OrganizationComponent organizationComponent) {
        collages.add( organizationComponent);
    }

    @Override
    public void delete(OrganizationComponent organizationComponent) {
        collages.remove(organizationComponent);
    }
}
